package com.vhall.component.entity.tag.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author guoxin.wang
 * @date 2021/7/2 18:00
 */
@Data
public class TagPage<T extends Serializable> implements Serializable {

    private static final long serialVersionUID = 1058377953210484387L;

    private Integer total;

    @JsonProperty("total_page")
    private Integer totalPage;

    @JsonProperty("page")
    private Integer currPage;

    @JsonProperty("list")
    private List<T> data;

    public TagPage(Page<T> page) {
        this.totalPage = (int) page.getPages();
        this.currPage = (int) page.getCurrent();
        this.total = (int) page.getTotal();
        this.data = page.getRecords();
    }

}
